{% extends "sklad/base-tree.html" %}
{% block content %}
<h3>
Запчасти - Выдача 
</h3>
{% block contenttitle %}
{% endblock %} 

{% if waybill %}

<div class="pagination">
    <span class="step-links">
        {% if waybill.has_previous %}
            <a href="?page={{ waybill.previous_page_number }}">&lsaquo;&lsaquo;&lsaquo;&nbsp;Предыдущая</a>
            &sdot;
        {% endif %}
        <span class="current">
            Страница <b>{{ waybill.number }}</b> из {{ waybill.paginator.num_pages }}
        </span>
        {% if waybill.has_next %}
            &sdot;
            <a href="?page={{ waybill.next_page_number }}">Следующая&nbsp;&rsaquo;&rsaquo;&rsaquo;</a>
        {% endif %}
    </span>
</div>

{% comment %}{% endcomment %}
<table class="table_list">
    <tr>
        <th>Дата</th>
        <th>Документ</th>
        <th>Наименование</th>
        <th>Код</th>
        <th>Кол-во</th>
        <th>Отдел</th>
        <th>Получил</th>
    </tr>
    {% for item in waybill.object_list %}
    <tr class="{% ifequal item.count__sum 0 %}hide_tr{% else %}{% cycle 'even' 'odd' %}{% endifequal %}">
            <td><nobr>{{ item.document.date_reg|date:"d M Y"  }}</nobr></td>
        <td>
            <a href="{% url document_detail item.document.id %}">{{ item.document.id }}</a>
        </td>
        <td>
             <a href="{% url part_detail item.part.id %}">{{ item.part.name }}</a>
        </td>
        <td>{{ item.part.code }}</td>
        <td>{{ item.quantity }}</td>
        <td>{{ item.document.documentdelivery.department.name }}</td>
        <td>{{ item.document.documentdelivery.person }}</td>
    </tr>
    {% endfor %}
</table>

<div class="pagination">
    <span class="step-links">
        {% if waybill.has_previous %}
            <a href="?page={{ waybill.previous_page_number }}">&lsaquo;&lsaquo;&lsaquo;&nbsp;Предыдущая</a>
            &sdot;
        {% endif %}
        <span class="current">
            Страница <b>{{ waybill.number }}</b> из {{ waybill.paginator.num_pages }}
        </span>
        {% if waybill.has_next %}
            &sdot;
            <a href="?page={{ waybill.next_page_number }}">Следующая&nbsp;&rsaquo;&rsaquo;&rsaquo;</a>
        {% endif %}
    </span>
</div>

{% endif %}

{% endblock %}
